<template>
  <div v-loading.fullscreen="fullscreenLoading" v-if="inited">
    <el-popover placement="left" trigger="hover">
      <template>
        <div class="pop-main">
          <el-divider content-position="left">打印/导出</el-divider>

          <el-row :gutter="10">
            <el-col :span="6" class="menu-list">
              <div @click="toEditSelectPrint" v-if="permission('print_label')">
                打印运单标签
              </div>
              <div @click="toPrintwaybillLabel">打印面单标签</div>
              <div
                @click="printWaybill10Label"
                v-if="permission('print_waybill_10_label')"
              >
                打印10X0标签
              </div>
              <div
                @click="
                  downLoadFile('printGreenBoxLabel', '打印GreenBox面单', '', '')
                "
                v-if="permission('print_green_box_Label')"
              >
                打印GreenBox面单
              </div>
            </el-col>
            <el-col :span="6" class="menu-list">
              <div
                @click="exportTrackNumber()"
                v-if="permission('export_tracking')"
              >
                导出追踪号
              </div>
              <div
                @click="exportWaybillBillToPdf()"
                v-if="
                  permission('export_waybill_bill_to_pdf') &&
                    this.data['billStatus'] == 1
                "
              >
                导出运单单票账单
              </div>
              <div
                @click="exportWaybillBillToPdf(0)"
                v-if="
                  permission('export_waybill_bill_to_pdf') &&
                    this.data['billStatus'] == 1
                "
              >
                导出起运港账单
              </div>
              <div
                @click="exportWaybillBillToPdf(1)"
                v-if="
                  permission('export_waybill_bill_to_pdf') &&
                    this.data['portOfDestinationBillStatus'] == 1
                "
              >
                导出目的港账单
              </div>
              <div
                @click="createLiquidationPacking('erp')"
                v-if="permission('create_liquidation_packing')"
              >
                导出已上传清关发票
              </div>
              <div
                @click="createLiquidationPacking('customer')"
                v-if="permission('customer_liquidation_packing')"
              >
                导出客户原始箱单
              </div>
            </el-col>

            <el-col :span="6" class="menu-list" v-if="excelInfoShow">
              <div
                v-for="(item, k) in fiveExcelFileInfos"
                :key="k"
                @click="exportSingleTicket(item.id, item.fileName, item)"
              >
                <span
                  style="font-size: 14px; font-color: red"
                  class="el-link--inner"
                >
                  导出{{ item.fileName }}</span
                >
              </div>
            </el-col>

            <el-col :span="6" class="menu-list" v-if="excelInfoShow">
              <el-tooltip effect="light" placement="left">
                <div slot="content">
                  <div style="width: 430px">
                    <el-button
                      type="text"
                      v-for="(item, k) in excelFileInfos"
                      :key="k"
                      @click="exportSingleTicket(item.id, item.fileName, item)"
                    >
                      导出{{ item.fileName }}
                    </el-button>
                  </div>
                </div>
                <em style="font-size: 14px" @click="intitExcelFileInfos(1)"
                  >全部模板</em
                >
              </el-tooltip>
            </el-col>
          </el-row>
          <el-divider content-position="left">常规操作</el-divider>
          <el-row class="margin-top">
            <el-col :span="8" class="menu-list">
              <div
                @click="
                  postEdit('waybillRebuildFreightAccomplish', '重新生成运费')
                "
                v-if="
                  permission('waybill_rebuild_freight_accomplish') &&
                    this.data['status'] > 30
                "
              >
                重新生成运费
              </div>
              <div
                @click="postEdit('clearSubwaybillLabel', '清除运单追踪号信息')"
                v-if="
                  permission('clear_subwaybill_label') &&
                    this.data['status'] > 30
                "
              >
                清除运单追踪号信息
              </div>
              <div
                @click="
                  postEdit(
                    'batchReBuildAmoebaChannelCost',
                    '重新生成阿米巴渠道费用'
                  )
                "
                v-if="
                  permission('batch_rebuild_amoeba_channel_cost') &&
                    this.data['status'] > 30
                "
              >
                重新生成阿米巴渠道费用
              </div>
              <div
                @click="
                  postEdit(
                    'batchReBuildAmoebaDepotCost',
                    '重新生成阿米巴仓库费用'
                  )
                "
                v-if="
                  permission('batch_re_build_amoeba_depot_cost') &&
                    this.data['status'] > 30
                "
              >
                重新生成阿米巴仓库费用
              </div>
              <div
                @click="
                  postEdit(
                    'repairWaybillAmoebaExternalSales',
                    '更新对外销售结算人'
                  )
                "
                v-if="
                  permission('repair_waybill_amoeba_external_sales') &&
                    this.data['status'] > 30
                "
              >
                更新对外销售结算人
              </div>
              <div
                @click="
                  postEdit(
                    'repairWaybillAmoebaPayBelongGroup',
                    '更新ERP应付转阿米巴费用所属部门'
                  )
                "
                v-if="
                  permission('repair_waybill_amoeba_pay_belong_group') &&
                    this.data['status'] > 30
                "
              >
                更新ERP应付转阿米巴费用所属部门
              </div>
              <div
                @click="postEdit('pushWaybillMergeToAgent', '推送至代理')"
                v-if="
                  permission('push_waybill_merge_to_agent') &&
                    this.data['hasBeenPushed'] == 0 &&
                    null != this.data['customsClearanceAgent']
                "
              >
                推送至代理({{ agentMap[data["customsClearanceAgent"]] }})
              </div>
              <div v-else style="pointer-events: none">
                <span style="color: #989a9c">
                  推送至代理({{ agentMap[data["customsClearanceAgent"]] }})
                </span>
              </div>
              <!--推送至派送服务商-->
              <div
                @click="postEdit('pushWaybillMergeToAgent', '推送至代理')"
                v-if="
                  permission('push_waybill_merge_to_agent') &&
                    this.data['hasBeenPushed'] == 0 &&
                    null != this.data['afterSendServicer']
                "
              >
                推送至派送服务商({{ agentMap[data["afterSendServicer"]] }})
              </div>
              <div v-else style="pointer-events: none">
                <span style="color: #989a9c">
                  推送至派送服务商({{ agentMap[data["afterSendServicer"]] }})
                </span>
              </div>
              <div
                @click="
                  postEdit('alloctionGreenBoxTrackNumber', '分配GreenBox追踪号')
                "
                v-if="permission('alloction_green_boxtrack_number')"
              >
                分配GreenBox追踪号
              </div>
              <!-- <div
              @click="postEdit('rebuildAmazonShipmentIndex', '重建索引')"
              v-if="permission('rebuild_amazon_shipment_index')"
            >
              重建索引
            </div> -->
              <div
                @click="
                  postEdit('unfreezeWaybillNotProblem', '解冻运单(无问题件)')
                "
                v-if="
                  permission('unfreeze_waybillno_problem') &&
                    this.data['status'] == -10
                "
              >
                解冻运单(无问题件)
              </div>
              <div
                @click="
                  postEdit('returnBankWaitForOutStock', '待上网打回待出库')
                "
                v-if="
                  permission('return_bank_wait_for_out_stock') &&
                    (this.data['status'] == 50 || this.data['status'] == 60) &&
                    this.data['shippingWay'] == '99'
                "
              >
                待上网打回待出库
              </div>
              <div
                @click="
                  postEdit('returnBankWaitForOutStock', '待报关打回待出库')
                "
                v-if="
                  permission('return_bank_wait_for_out_stock') &&
                    (this.data['status'] == 50 || this.data['status'] == 60)
                "
              >
                待报关打回待出库
              </div>
              <div
                @click="
                  postEdit(
                    'warehouseReturnBankWaitForDealSend',
                    '待入库打回待交寄'
                  )
                "
                v-if="
                  permission('returnbank_wait_fordeal_send') &&
                    this.data['status'] == 30
                "
              >
                待入库打回待交寄
              </div>
              <div
                @click="touUpdateInstockDate"
                v-if="
                  permission('update_instock_date') &&
                    this.data['status'] == -20
                "
              >
                修改入库时间
              </div>
              <div
                @click="toForceStatus"
                v-if="permission('force_waybill_status')"
              >
                强行修改运单状态
              </div>
              <div
                @click="toTotalPackages"
                v-if="permission('force_waybill_count')"
              >
                强行修改运单预报件数
              </div>
            </el-col>
            <el-col :span="8" class="menu-list">
              <div
                @click="postEdit('waybillTrackBack', '打回轨迹')"
                v-if="
                  permission('waybill_track_back') &&
                    this.data['status'] > 40 &&
                    this.data['status'] <= 888 &&
                    (this.data['shippingWay'] == 'FCL' ||
                      this.data['shippingWay'] == 'LCL' ||
                      this.data['shippingWay'] == 'AIR' ||
                      this.data['shippingWay'] == 'ZX')
                "
              >
                打回轨迹
              </div>
              <div
                @click="toEditOverseasOperator"
                v-if="
                  permission('edit_overseas_operator') &&
                    (this.data['shippingWay'] == 'FCL' ||
                      this.data['shippingWay'] == 'LCL')
                "
              >
                修改海外操作
              </div>
              <div
                @click="toEditDispatchAddress"
                v-if="permission('edit_dispatch_address')"
              >
                修改派送地址
              </div>
              <div
                @click="toEditWarehouseAddress"
                v-if="permission('edit_warehouse_address')"
              >
                修改仓库派送地址
              </div>
              <div
                @click="toEditReferenceNo"
                v-if="permission('edit_reference_no')"
              >
                修改参考号
              </div>
              <div
                @click="toEditOperationRemark"
                v-if="permission('edit_operation_remark')"
              >
                修改操作备注
              </div>
              <div
                @click="toAddOperationRemark"
                v-if="permission('add_operation_remark')"
              >
                新增操作备注
              </div>
              <div
                @click="toEditCustomerRemark"
                v-if="permission('edit_customer_remark')"
              >
                修改客户备注
              </div>
              <div
                @click="editUpdateHwaybill"
                v-if="permission('edit_update_hwaybill')"
              >
                修改H单信息
              </div>
              <div
                @click="toForceUpdateprovinceId"
                v-if="permission('force_update_provinceid')"
              >
                修改国内分区
              </div>
              <div
                @click="toForceUpdateChannel"
                v-if="permission('force_update_channel')"
              >
                直接修改渠道
              </div>
              <div
                @click="
                  postEdit('outStockReturnBackToDealSend', '待出库打回待交寄')
                "
                v-if="
                  permission('out_stock_return_back_todeal_send') &&
                    this.data['status'] == 40
                "
              >
                待出库打回待交寄
              </div>
              <div
                @click="editEoriIsCertified"
                v-if="permission('edit_eori_is_certified')"
              >
                修改进口商是否认证
              </div>
              <div
                @click="
                  postEdit(
                    'trackingMoreOnceByWaybillId',
                    'trackingMore轨迹追踪'
                  )
                "
                v-if="
                  permission('tracking_more_once_by_waybill') &&
                    (this.data['status'] == 135 ||
                      this.data['status'] == 140 ||
                      this.data['status'] == 50)
                "
              >
                trackingMore轨迹追踪
              </div>
              <!-- <div
                @click="postEdit('pushOrder2ToFBA', '推送订单至九方系统')"
                v-if="
                  permission('push_order2_to_fba') && this.data['status'] == 20
                "
              >
                推送订单至九方系统
              </div> -->
              <!-- <div
                @click="postEdit('pushOrder2ToNb', '推送订单至宁波系统')"
                v-if="
                  permission('push_order2_to_nb') && this.data['status'] == 20
                "
              >
                推送订单至宁波系统
              </div> -->
              <div
                @click="
                  postEdit('newPushOrder2ToNb', '推送订单至宁波系统（新）')
                "
                v-if="
                  permission('push_order2_to_nb') && this.data['status'] == 20
                "
              >
                推送订单至宁波系统（新）
              </div>
              <div
                @click="
                  postEdit('newPushOrderToJF', '推送订单至九方系统（新）')
                "
                v-if="
                  permission('push_order2_to_fba') && this.data['status'] == 20
                "
              >
                推送订单至九方系统（新）
              </div>
              <!-- <div
                @click="postEdit('postInstockDataByWaybillId', '推送入库数据')"
                v-if="
                  permission('post_instock_data_by_waybillid') &&
                    this.data['referenceNo'] != ''
                "
              >
                推送入库数据
              </div> -->
              <div
                @click="
                  postEdit('newPushInstockToJF', '推送入库数据至宁波(新)')
                "
                v-if="
                  permission('post_instock_data_by_waybillid') &&
                    this.data['referenceNo'] != ''
                "
              >
                推送入库数据至九方（新）
              </div>
              <div
                @click="postEdit('manualPushTrackingNumber', '推送追踪号数据')"
                v-if="permission('manual_push_tracking_number')"
              >
                推送追踪号数据
              </div>
              <div
                @click="postEdit('checkFbaNoNotInSub', '校验FBA箱号')"
                v-if="permission('check_fbano_not_in_sub')"
              >
                校验FBA箱号
              </div>
              <div
                @click="postEdit('arrangeExamine', '安排查验')"
                v-if="this.data['status'] == 40 || this.data['status'] == -10"
              >
                安排查验
              </div>
              <div
                @click="toBatchImportTrackLabel"
                v-if="permission('import_track_label')"
              >
                导入标签
              </div>
              <div
                @click="viewPackOriginalData"
                v-if="permission('view_pack_original_data')"
              >
                查看箱单原始数据
              </div>
            </el-col>
            <el-col :span="8" class="menu-list">
              <div @click="toEdit" v-if="permission('to_edit')">全编辑</div>
              <div @click="toEditRemarks" v-if="permission('edit_remarks')">
                备注
              </div>
              <div @click="changeOrderType" v-if="permission('change_order')">
                改单
              </div>

              <div
                @click="toEditExamineResult"
                v-if="
                  permission('edit_examine_result') &&
                    this.data['isNeedExamine'] == 1
                "
              >
                修改查验结果
              </div>
              <!-- <div @click="toDetails"  v-if="permission('to_details')">运单详情</div> -->
              <div
                @click="postEdit('updateBillStatus', '生成起运港账单')"
                v-if="permission('update_bill_status')"
              >
                生成起运港账单
              </div>
              <div
                @click="
                  postEdit(
                    'updatePortOfDestinationBillStatus',
                    '生成目的港账单'
                  )
                "
                v-if="permission('update_port_of_destination_bill_status')"
              >
                生成目的港账单
              </div>
              <div @click="toEditSheetNo" v-if="permission('to_edit_sheet_no')">
                修改面单号
              </div>
              <div @click="toEditTrackNo" v-if="permission('to_edit_track_no')">
                修改跟踪号
              </div>
              <div
                @click="toEditSubwaybillTrackNo"
                v-if="permission('to_edit_subwaybill_trackNo')"
              >
                修改子单跟踪号
              </div>
              <div
                @click="createProblemPiece"
                v-if="permission('create_problem_piece')"
              >
                生成问题件
              </div>
              <div
                @click="postParamsEditReturn"
                v-if="
                  permission('return_way_bill') &&
                    this.data['status'] != -10 &&
                    this.data['status'] != -20
                "
              >
                退货处理
              </div>
              <div
                @click="
                  postParamsEdit(
                    'restoreWaybill',
                    '恢复',
                    'attrName',
                    'restoreWaybill'
                  )
                "
                v-if="
                  permission('restore_way_bill') && this.data['status'] == -20
                "
              >
                恢复
              </div>
              <!-- <div>编辑箱单</div>  已弃用-->
              <div
                @click="postEdit('cancelLockWaybill', '取消锁单')"
                v-if="
                  permission('cancel_lock_waybill') &&
                    this.data['status'] == 999
                "
              >
                取消锁单
              </div>
              <div
                @click="postEdit('returnWaitForConfirm', '打回待确认')"
                v-if="
                  permission('return_wait_for_confirm') &&
                    this.data['status'] == 20
                "
              >
                打回待确认
              </div>
              <div
                @click="toUpdateWaybillOutStock"
                v-if="
                  permission('to_update_waybill_out_stock') &&
                    (this.data['status'] == 40 || this.data['status'] == -10)
                "
              >
                修改出库渠道
              </div>
              <!-- 直接跳转到物流模块 -->
              <div
                @click="toInStock()"
                v-if="
                  permission('to_in_stock') &&
                    this.data['inStockOperationId'] != ''
                "
              >
                编辑入库单
              </div>
              <div
                @click="
                  postParamsEdit(
                    'updateWaybillOrderLocked',
                    '锁定',
                    'orderLocked',
                    0
                  )
                "
                v-if="
                  permission('order_locked') &&
                    (!this.data['orderLocked'] ||
                      this.data['orderLocked'] == 0) &&
                    this.data['status'] > 40
                "
              >
                锁定
              </div>
              <div
                @click="
                  postParamsEdit(
                    'updateWaybillOrderLocked',
                    '解锁',
                    'orderLocked',
                    1
                  )
                "
                v-if="
                  permission('update_waybill_order_locked') &&
                    this.data['orderLocked'] == 1
                "
              >
                解锁
              </div>

              <div
                v-if="permission('to_locked_pay')"
                @click="
                  postParamsEdit(
                    'updateWaybillOrderLockedByPay',
                    '付费解锁',
                    'orderLocked',
                    1
                  )
                "
              >
                付费解锁
                <!--  v-if="this.data['orderLocked'] == 1" -->
              </div>

              <div
                @click="toApprovalPass"
                v-if="
                  permission('to_approval_pass') &&
                    this.data['examineAndApprove'] == 0 &&
                    (this.data['shippingWay'] == 'FCL' ||
                      this.data['shippingWay'] == 'LCL')
                "
              >
                审批通过
              </div>
              <div
                @click="
                  postEdit('relieveFromMergeOrder', '解除空运合单', {
                    class: 'com.tofba.app.client.seaair.WaybillOperationClient'
                  })
                "
                v-if="
                  this.data['waybillMergeId'] &&
                    permission('relieve_from_merge_order')
                "
              >
                解除 海空运合单
              </div>
              <div
                @click="toDismantle()"
                v-if="
                  permission('to_dismantle') &&
                    (this.data['status'] == -10 ||
                      (this.data['status'] > 30 && this.data['status'] < 90))
                "
              >
                运单拆单
              </div>
            </el-col>
          </el-row>
        </div>
      </template>
      <div slot="reference">
        <span class="text-blue">操作</span>
      </div>
    </el-popover>
    <UpdateInstockDate ref="UpdateInstockDate" :data="data"></UpdateInstockDate>
    <ViewPackOriginalData
      ref="ViewPackOriginalData"
      :data="data"
      :tableData="viewPackOriginaltableData"
    ></ViewPackOriginalData>
    <ToBatchImportTrackLabel
      ref="ToBatchImportTrackLabel"
      :data="data"
    ></ToBatchImportTrackLabel>
    <EditEoriIsCertified
      ref="EditEoriIsCertified"
      :data="data"
    ></EditEoriIsCertified>
    <ToForceUpdateprovinceId
      ref="ToForceUpdateprovinceId"
      :data="data"
      :countryStateSource="countryStateSource"
    ></ToForceUpdateprovinceId>
    <ToForceUpdateChannel
      ref="ToForceUpdateChannel"
      :data="data"
      :outStockChannelOptions="outStockChannelOptions"
      :inStockChannelOptions="inStockChannelOptions"
    ></ToForceUpdateChannel>
    <EditUpdateHwaybill
      ref="EditUpdateHwaybill"
      :data="data"
    ></EditUpdateHwaybill>
    <EditOperationRemark
      ref="EditOperationRemark"
      :data="data"
    ></EditOperationRemark>
    <AddOperationRemark
      ref="AddOperationRemark"
      :data="data"
    ></AddOperationRemark>
    <EditCustomerRemark
      ref="EditCustomerRemark"
      :data="data"
    ></EditCustomerRemark>
    <EditReferenceNo ref="EditReferenceNo" :data="data"></EditReferenceNo>
    <EditWarehouseAddress
      ref="EditWarehouseAddress"
      :data="data"
      :addressFbaMap="addressFbaMap"
    ></EditWarehouseAddress>
    <EditDispatchAddress
      ref="EditDispatchAddress"
      :data="data"
    ></EditDispatchAddress>
    <ApprovalPass
      ref="ApprovalPass"
      :data="data"
      :userOptions="userOptions"
      :serviceOptions="serviceOptions"
    ></ApprovalPass>
    <ToUpdateWaybillOutStock
      ref="ToUpdateWaybillOutStock"
      :data="data"
      :outStockChannelOptions="outStockChannelOptions"
    ></ToUpdateWaybillOutStock>
    <CreateProblemPiece
      ref="CreateProblemPiece"
      :data="data"
      :userOptions="userOptions"
      :problemTypeOptions="problemTypeOptions"
    ></CreateProblemPiece>
    <EditSubwaybillTrackNo
      ref="EditSubwaybillTrackNo"
      :data="data"
      :tableData="editSubwaybillTrackNoData"
    ></EditSubwaybillTrackNo>
    <EditTrackNo ref="EditTrackNo" :data="data"></EditTrackNo>
    <EditSheetNo ref="EditSheetNo" :data="data"></EditSheetNo>
    <EditExamineResult ref="EditExamineResult" :data="data"></EditExamineResult>
    <EditRemarks
      ref="EditRemarks"
      :data="data"
      :userOptions="userOptions"
    ></EditRemarks>
    <ChangeOrder
      ref="ChangeOrder"
      :data="data"
      @editWaybillInfo="editWaybillInfo"
    ></ChangeOrder>
    <EditSelectPrint ref="EditSelectPrint" :data="data"></EditSelectPrint>
    <EditOverseasOperator
      ref="EditOverseasOperator"
      :data="data"
      :userOptions="userOptions"
    ></EditOverseasOperator>
    <ForceStatus
      ref="ForceStatus"
      :data="data"
      v-if="forceStatusshow"
    ></ForceStatus>
    <TotalPackages
      ref="TotalPackages"
      :data="data"
      v-if="totalPackagesshow"
    ></TotalPackages>
    <PrintwaybillLabel
      ref="PrintwaybillLabel"
      :data="data"
      v-if="printwaybillLabelshow"
    ></PrintwaybillLabel>

    <el-dialog
      title="退货处理"
      :visible.sync="boosyn"
      style="width: 50%; margin-left: 400px"
    >
      <span class="title-icon">为方便统计利润，请填写入库时间（时分）</span>
      <div>
        <el-date-picker
          v-model="inStockTime"
          type="datetime"
          placeholder="选择日期"
          format="yyyy-MM-dd HH:mm:ss"
          value-format="yyyy-MM-dd HH:mm:ss"
        >
        </el-date-picker>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="cancelInStockTime">取消</el-button>
        <el-button type="primary" @click="postParamsEditReturn">确定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import { ajax, actionPermission } from "@/store/yg/common/utils";
import axios from "axios";
import * as constant from "@/store/yg/common/constant";
import { m } from "@/store/yg/common/local";
import { getLodop } from "@/store/yg/common/LodopFuncs";

const UpdateInstockDate = () => import("./editpage/UpdateInstockDate");
const ViewPackOriginalData = () => import("./editpage/ViewPackOriginalData");
const ToBatchImportTrackLabel = () =>
  import("./editpage/ToBatchImportTrackLabel");
const EditEoriIsCertified = () => import("./editpage/EditEoriIsCertified");
const ToForceUpdateprovinceId = () =>
  import("./editpage/ToForceUpdateprovinceId");
const ToForceUpdateChannel = () => import("./editpage/ToForceUpdateChannel");
const EditUpdateHwaybill = () => import("./editpage/EditUpdateHwaybill");
const EditOperationRemark = () => import("./editpage/EditOperationRemark");
const AddOperationRemark = () => import("./editpage/AddOperationRemark");
const EditCustomerRemark = () => import("./editpage/EditCustomerRemark");
const EditReferenceNo = () => import("./editpage/EditReferenceNo");
const EditWarehouseAddress = () => import("./editpage/EditWarehouseAddress");
const EditDispatchAddress = () => import("./editpage/EditDispatchAddress");
const ApprovalPass = () => import("./editpage/ApprovalPass");
const ToUpdateWaybillOutStock = () =>
  import("./editpage/ToUpdateWaybillOutStock");
const CreateProblemPiece = () => import("./editpage/CreateProblemPiece");
const EditSubwaybillTrackNo = () => import("./editpage/EditSubwaybillTrackNo");
const EditTrackNo = () => import("./editpage/EditTrackNo");
const EditSheetNo = () => import("./editpage/EditSheetNo");
const EditExamineResult = () => import("./editpage/EditExamineResult");
const EditRemarks = () => import("./editpage/EditRemarks");
const ChangeOrder = () => import("./editpage/ChangeOrder");
const EditSelectPrint = () => import("./editpage/EditSelectPrint");
const EditOverseasOperator = () => import("./mergepage/EditOverseasOperator");
const ForceStatus = () => import("./editpage/ForceStatus");
const TotalPackages = () => import("./editpage/TotalPackages");
const PrintwaybillLabel = () => import("./editpage/PrintwaybillLabel");

export default {
  components: {
    UpdateInstockDate,
    ViewPackOriginalData,
    ToBatchImportTrackLabel,
    EditEoriIsCertified,
    ToForceUpdateprovinceId,
    ToForceUpdateChannel,
    EditUpdateHwaybill,
    EditOperationRemark,
    AddOperationRemark,
    EditCustomerRemark,
    EditReferenceNo,
    EditWarehouseAddress,
    EditDispatchAddress,
    ApprovalPass,
    ToUpdateWaybillOutStock,
    CreateProblemPiece,
    EditSubwaybillTrackNo,
    EditTrackNo,
    EditSheetNo,
    EditExamineResult,
    EditRemarks,
    ChangeOrder,
    EditSelectPrint,
    EditOverseasOperator,
    ForceStatus,
    TotalPackages,
    PrintwaybillLabel
  },

  data() {
    return {
      addressFbaMap: {},
      agentMap: {},
      disabled: false,
      fullscreenLoading: false,
      surfaceSingles: [],
      excelFileInfos: [],
      excelInfoShow: false,
      shippingWay: "",
      printwaybillLabelshow: false,
      totalPackagesshow: false,
      forceStatusshow: false,
      viewPackOriginalDatashow: false,
      viewPackOriginaltableData: [],
      editSubwaybillTrackNoshow: false,
      editSubwaybillTrackNoData: [],
      //国内分区
      countryStateSource: {},
      //出库渠道
      outStockChannelOptions: {},
      //入库渠道
      inStockChannelOptions: {},
      //用户
      userOptions: {},
      //问题件类型
      problemTypeOptions: {},
      fiveExcelFileInfos: [],

      serviceOptions: {},
      rules: {},
      inited: false,
      boosyn: false,
      inStockTime: ""
    };
  },
  props: ["row", "data", "more", "editRules"],
  computed: {},
  mounted() {
    this.shippingWay = this.data["shippingWay"];
    this.intitExcelFileInfos(0);
    this.fetchAgentApi();
    if (this.data["customsClearanceAgent"] && this.data["hasBeenPushed"] == 0) {
      this.disabled = true;
    }
    if (this.data["afterSendServicer"] && this.data["hasBeenPushed"] == 0) {
      this.disabled = true;
    }
    const nowUrl = this.$route.path;
    this.displayRules();
  },
  methods: {
    displayRules() {
      this.shippingWay = this.data["shippingWay"];
      if (this.editRules) {
        this.rules = this.editRules;
        this.inited = true;
      } else {
        for (var i in this.$store.state.main.entry.table.action) {
          let a = this.$store.state.main.entry.table.action[i];
          if (a.displayRule) {
            this.rules[a.client.commit] = a.displayRule;
          }
        }
        this.inited = true;
      }
    },
    // 初始化 下载
    fetchAgentApi() {
      var param = {};
      var key = "agent_api_init";
      var agents = JSON.parse(sessionStorage.getItem(key));

      if (!agents || agents == "{}" || agents == null || agents == "null") {
        ajax("fetchAgentApi", param).then(
          res => {
            if (res.code == 200) {
              this.agentMap = res.data;
              sessionStorage.setItem(key, JSON.stringify(this.agentMap));
            }
          },
          error => {
            console.log(error);
          }
        );
      } else {
        this.agentMap = agents;
      }
    },
    exportSingleTicket(excelFileId, fileName, item) {
      var fiveKey = "five_excel_init_x" + this.shippingWay;
      var fiveInfos = JSON.parse(sessionStorage.getItem(fiveKey));
      //首先看当前 点击是否已经在缓存里面 如果在 向前移动
      //如果不存在 删除首位 放在末位 数组先入的在最下面
      if (fiveInfos && fiveInfos.length > 0) {
        var checckExit = false;
        for (let index = 0; index < fiveInfos.length; index++) {
          const element = fiveInfos[index];
          if (excelFileId === element.id) {
            fiveInfos.splice(index, 1);
            checckExit = true;
          }
        }
        if (!checckExit) {
          fiveInfos.splice(0, 1);
        }
      } else {
        fiveInfos = [];
      }
      fiveInfos.push(item);
      sessionStorage.setItem(fiveKey, JSON.stringify(fiveInfos));

      var param = {};
      this.fullscreenLoading = true;
      param["statementTemplateId"] = excelFileId;
      // param["shippingWay"] = this.data['shippingWay'];
      param["waybillId"] = this.data["id"];
      param["code"] = "Y";
      // console.info('excelFileId',param);
      ajax("reportWaybillData", param).then(
        res => {
          console.log(res);
          this.fullscreenLoading = false;
          if (res.code == 200) {
            var path = (path = constant.FILE_SERVER + res.message);
            if (res.message) {
              fileName = res.message.substring(
                res.message.lastIndexOf("/") + 1,
                res.message.length
              );
            }

            window.open(
              constant.API_SERVER +
                "/open/downloadFileByHttp?fileName=" +
                fileName +
                "&path=" +
                path
            );

            // console.log(fileUrl);
            // window.open(fileUrl);
          } else {
            if (null != res.message) {
              this.$message.error("导出失败原因：" + res.message);
            } else {
              this.$message.error("导出失败");
            }
          }
        },
        error => {
          console.log(error);
        }
      );
    },

    // 初始化 下载
    intitExcelFileInfos(loadType) {
      var param = {};
      this.shippingWay = this.data["shippingWay"];
      var key = "excel_init_Y" + this.shippingWay;
      var fileInfos = JSON.parse(sessionStorage.getItem(key));

      var fiveKey = "five_excel_init_x" + this.shippingWay;
      var fiveInfos = JSON.parse(sessionStorage.getItem(fiveKey));

      if (
        loadType == 1 ||
        !fileInfos ||
        fileInfos == "{}" ||
        null == fileInfos ||
        "null" == fileInfos
      ) {
        param["shippingWayType"] = this.shippingWay;
        param["code"] = "Y";
        ajax("intitExcelFileInfos", param).then(
          res => {
            this.excelInfoShow = true;
            if (res.code == 200) {
              this.excelFileInfos = res.data;
              sessionStorage.setItem(key, JSON.stringify(this.excelFileInfos));
              if (this.excelFileInfos && this.excelFileInfos.length > 0) {
                if (!fiveInfos || fiveInfos.length == 0) {
                  fiveInfos = [];
                  if (this.excelFileInfos.length > 5) {
                    for (let index = 0; index < 5; index++) {
                      const nowExcelFile = this.excelFileInfos[index];
                      fiveInfos.push(nowExcelFile);
                    }
                  } else {
                    fiveInfos = this.excelFileInfos;
                  }
                }
                sessionStorage.setItem(fiveKey, JSON.stringify(fiveInfos));
                this.fiveExcelFileInfos = fiveInfos;
              }
              this.excelInfoShow = true;
            }
          },
          error => {
            console.log(error);
          }
        );
      } else {
        if (fileInfos && fileInfos.length > 0) {
          if (!fiveInfos || fiveInfos.length == 0) {
            fiveInfos = [];
            if (fileInfos.length > 5) {
              for (let index = 0; index < 5; index++) {
                const nowExcelFile = fileInfos[index];
                fiveInfos.push(nowExcelFile);
              }
            } else {
              fiveInfos = fileInfos;
            }
            sessionStorage.setItem(fiveKey, JSON.stringify(fiveInfos));
          }
          this.fiveExcelFileInfos = fiveInfos;
          this.excelInfoShow = true;
        }
        this.excelFileInfos = fileInfos;
      }
    },

    permission(commit) {
      return actionPermission(this.rules, commit, this.data, this.$store.state);
    },
    toPrintwaybillLabel() {
      var param = {};
      param["waybillId"] = this.data["id"];
      this.printwaybillLabelshow = true;
      ajax("printExpressSheet", param).then(
        res => {
          console.log(res);
          this.fullscreenLoading = false;
          if (res.code === 200) {
            if (
              typeof this.$refs.PrintwaybillLabel != "undefined" &&
              this.$refs.PrintwaybillLabel != null
            ) {
              this.$refs.PrintwaybillLabel.centerDialogVisible = true;
              this.$refs.PrintwaybillLabel.surfaceSingleHtml =
                res.data["surfaceSingleHtml"];
              this.$refs.PrintwaybillLabel.waybillId = this.data["id"];
              this.$refs.PrintwaybillLabel.surfaceSingleCode =
                res.data["surfaceSingleCode"];
            }
          }
          loading.close();
        },
        error => {
          console.log(error);
        }
      );
    },

    toTotalPackages() {
      this.totalPackagesshow = true;
      this.$refs.TotalPackages.centerDialogVisible = true;
    },
    //强制修改状态
    toForceStatus() {
      this.forceStatusshow = true;
      this.$refs.ForceStatus.centerDialogVisible = true;
    },
    //修改海外操作
    toEditOverseasOperator() {
      this.$refs.EditOverseasOperator.centerDialogVisible = true;
      var uri = "/api/entry/source?bean=userSource";
      axios.post(constant.API_SERVER + uri).then(
        response => {
          this.userOptions = response.data;
        },
        error => {
          console.info(error);
        }
      );
    },

    exportWaybillBillToPdf(billType) {
      this.fullscreenLoading = true;
      var param = {};
      var ids = [];
      ids.push(this.data["id"]);
      param["ids"] = ids;
      ajax("exportWaybillBillToPdf", param).then(
        res => {
          this.fullscreenLoading = false;
          if (null != res.message && res.message != "") {
            this.$message.error(m(res.message));
          } else {
            var path = constant.FILE_SERVER + res.path;
            location.href =
              constant.API_SERVER +
              "/open/downloadFileByHttp?fileName=" +
              res.fileName +
              "&path=" +
              path;
          }
        },
        error => {
          console.log(error);
        }
      );
    },
    createLiquidationPacking(code) {
      this.fullscreenLoading = true;
      var param = {};
      param["id"] = this.data["id"];
      param["code"] = code;
      ajax("createLiquidationPacking", param).then(
        res => {
          console.log("createLiquidationPacking", res);
          this.fullscreenLoading = false;
          if (null != res.errorMesage && res.errorMesage != "") {
            this.$message.error(m(res.errorMesage));
          } else {
            var path = constant.FILE_SERVER + res.path;
            location.href =
              constant.API_SERVER +
              "/open/downloadFileByHttp?fileName=" +
              res.fileName +
              "&path=" +
              path;
          }
        },
        error => {
          console.log(error);
        }
      );
    },

    exportTrackNumber() {
      this.fullscreenLoading = true;
      var param = {};
      param["id"] = this.data["id"];
      ajax("exportTrackNumber", param).then(
        res => {
          this.fullscreenLoading = false;
          console.log("导出追踪号", res);
          if (null != res["errorMesage"] && res["errorMesage"] != "") {
            this.$message.error(m(res.errorMesage));
          } else {
            var path = constant.FILE_SERVER + res.path;
            location.href =
              constant.API_SERVER +
              "/open/downloadFileByHttp?fileName=" +
              res.fileName +
              "&path=" +
              path;
          }
        },
        error => {
          console.log(error);
        }
      );
    },

    //打印10x10 标签
    printWaybill10Label() {
      this.$confirm("此操作将打印10x10 标签是否继续？")
        .then(_ => {
          // TODO 保存操作
          var param = {};
          var waybillIds = [];
          waybillIds.push(this.data["id"]);
          param["waybillIds"] = waybillIds;
          param["status"] = this.data["status"];
          param["surfaceSingleCode"] = "WL10";

          ajax("printWaybillLabel", param).then(
            res => {
              this.fullscreenLoading = false;
              if (res.code != 200) {
                if (null != res.message) {
                  this.$message.error(m(res.message));
                } else {
                  this.$message.error("修改失败!");
                }
              } else {
                var htmls = res.data;
                if (null != htmls && htmls != "") {
                  this._print10(htmls, "");
                  this.centerDialogVisible = false;
                } else {
                  this.$message.error("没有可用面单模板!");
                }
              }
            },
            error => {
              console.log(error);
            }
          );
        })
        .catch(_ => {});
    },

    _print10(htmls, printName) {
      console.log("标签打印中" + printName + ",htmls.size=" + htmls.length);
      var LODOP = getLodop();
      LODOP.PRINT_INIT("打印订单信息");
      LODOP.SET_PRINT_PAGESIZE(1, "100mm", "100mm", "CreateCustomPage");
      for (var j = 0; j < htmls.length; j++) {
        var html = htmls[j];
        LODOP.ADD_PRINT_HTM(0, 0, "100mm", "98mm", html);
        var body = document.querySelector("body");
        body.append(
          "<div id='templateContentHtml' style='display:none'>" +
            html +
            "</div>"
        );
        var barCodes = document.getElementsByName("barcode");
        for (var i = 0; i < barCodes.length; i++) {
          var barCode = barCodes[i];
          var value = barCode.getAttribute("value");
          var values;
          if (value.indexOf("|") >= 0) {
            values = barCode.getAttribute("value").split("|");
          } else {
            values = barCode.getAttribute("value").split("-");
          }
          LODOP.ADD_PRINT_BARCODE(
            values[0],
            values[1],
            values[2],
            values[3],
            values[4],
            values[5]
          );
          LODOP.SET_PRINT_STYLEA(0, "ShowBarText", 1);
          if (values[6] == 1 || typeof values[6] == "undefined") {
            LODOP.SET_PRINT_STYLEA(0, "AlignJustify", 2);
          } else {
            LODOP.SET_PRINT_STYLEA(0, "ShowBarText", 0);
          }
        }
        // $("#templateContentHtml").remove();
        // var thisNode = document.getElementById("#templateContentHtml");
        // thisNode.parentElement.removeChild(thisNode);

        var templateContentHtml = document.querySelector("templateContentHtml");
        this.removeDom(templateContentHtml);
        LODOP.NewPage(); //分页
      }
      if (null != printName && printName != "") {
        LODOP.SET_PRINTER_INDEX(printName);
        LODOP.PRINT();
      } else {
        LODOP.PREVIEW();
      }
    },

    // 移除节点
    removeDom(model) {
      var self = this;
      if (self.$parent.model) {
        self.$parent.model.children.forEach((item, index) => {
          if (item.name == model.name) {
            self.$parent.model.children.splice(index, 1);
          }
        });
      }
    },

    downLoadFile(postUrl, info, paramsName, params) {
      this.$confirm("此操作将" + info + ", 是否继续？")
        .then(_ => {
          this.fullscreenLoading = true;
          // TODO 保存操作
          var param = {};
          param["id"] = this.data["id"];
          if (
            null != paramsName &&
            "" != paramsName &&
            null != params &&
            "" != params
          ) {
            param[paramsName] = params;
          }
          ajax(postUrl, param).then(
            res => {
              console.log(res);
              this.fullscreenLoading = false;
              if (res.code != 200) {
                if (null != res.message) {
                  this.$message.error(m(res.message));
                } else {
                  this.$message.error("导出失败!");
                }
              } else {
                var path = (path = constant.FILE_SERVER + "/" + res.data);
                location.href =
                  constant.API_SERVER +
                  "/open/downloadFileByHttp?fileName=" +
                  res.data +
                  "&path=" +
                  path;
                // window.open(path);
              }
            },
            error => {
              console.log(error);
            }
          );
        })
        .catch(_ => {});
    },
    //入库单编辑
    toInStock() {
      //获取当前路由地址
      var url = "#/blank/warehouse__manageinstock__main";
      let isFastInstock = this.data["isFastInstock"];
      if (isFastInstock && isFastInstock == 1) {
        url = "/#/blank/warehouse__fastInstock__main";
      }
      // this.$nextTick(()=>{
      // this.$store.dispatch("loadBlankEntry", url);
      url = url + "?pid=" + this.data["id"];
      window.open(url, "_blank");
    },
    toDismantle() {
      //获取当前路由地址
      var url = "#/blank/waybill__seaAirDismantle__main";
      // this.$nextTick(()=>{
      // this.$store.dispatch("loadBlankEntry", url);
      url = url + "?pid=" + this.data["id"];
      window.open(url, "_blank");
    },
    toEdit() {
      var url = "#/blank/waybill__alledit__main";
      // this.$nextTick(()=>{
      this.$store.dispatch("loadBlankEntry", url);
      url = url + "?waybillId=" + this.data["id"];
      location.href = url;
      //this.$store.dispatch('loadBlankEntry', url);

      // })
    },
    //查看详情
    // toDetails() {
    //   const url = "#/blank/waybill__alledit__main";
    //   this.$store.dispatch("loadBlankEntry", url);
    //   location.href = url + "?waybillId=" + this.data["id"];
    // },
    //打印运单标签
    toEditSelectPrint() {
      this.$refs.EditSelectPrint.centerDialogVisible = true;
    },
    //编辑备注
    toEditRemarks() {
      var param = {};
      ajax("getToapprovalPassOptions", param).then(
        res => {
          if (res.code == 200) {
            this.userOptions = res.data2;
          }
          this.$refs.EditRemarks.centerDialogVisible = true;
        },
        error => {
          console.log(error);
        }
      );
    },
    changeOrderType() {
      this.$refs.ChangeOrder.centerDialogVisible = true;
    },
    editWaybillInfo() {
      this.$emit("editWaybillInfo");
    },
    //查验结果
    toEditExamineResult() {
      this.$refs.EditExamineResult.centerDialogVisible = true;
    },
    //修改面单号
    toEditSheetNo() {
      this.$refs.EditSheetNo.centerDialogVisible = true;
    },
    //修改追踪号
    toEditTrackNo() {
      this.$refs.EditTrackNo.centerDialogVisible = true;
    },
    //修改子单追踪号
    toEditSubwaybillTrackNo() {
      var param = {};
      param["id"] = this.data["id"];
      this.$refs.EditSubwaybillTrackNo.centerDialogVisible = true;
      this.fullscreenLoading = true;
      ajax("getsubwaybilltracknos", param).then(
        res => {
          this.fullscreenLoading = false;
          if (res.code === 200) {
            this.editSubwaybillTrackNoData = res.data;
          }
        },
        error => {
          console.log(error);
        }
      );
    },
    //生成问题件
    createProblemPiece() {
      var param = {};
      if (this.data.status > 40) {
        this.$message.error("已出库的运单无法生成问题件!");
        return;
      }
      this.$refs.CreateProblemPiece.centerDialogVisible = true;
      ajax("getCreateProblemPieceOptions", param).then(
        res => {
          if (res.code == 200) {
            this.userOptions = res.data2;
            this.problemTypeOptions = res.data;
          }
        },
        error => {
          console.log(error);
        }
      );
    },

    //修改出库渠道
    toUpdateWaybillOutStock() {
      var param = {};
      ajax("getToForceUpdateChannelOptions", param).then(
        res => {
          if (res.code == 200) {
            this.outStockChannelOptions = res.data;
          }
          this.$refs.ToUpdateWaybillOutStock.centerDialogVisible = true;
        },
        error => {
          console.log(error);
        }
      );
    },
    //审批通过
    toApprovalPass() {
      var param = {};
      ajax("getToapprovalPassOptions", param).then(
        res => {
          if (res.code == 200) {
            this.userOptions = res.data2;
            this.serviceOptions = res.data;
          }
          this.$refs.ApprovalPass.centerDialogVisible = true;
        },
        error => {
          console.log(error);
        }
      );
    },
    //修改派送地址
    toEditDispatchAddress() {
      this.$refs.EditDispatchAddress.centerDialogVisible = true;
    },

    //修改仓库配送地址
    toEditWarehouseAddress() {
      var param = {};
      ajax("getFbaCodeMap", param).then(
        res => {
          if (res.code == 200) {
            this.addressFbaMap = res.data;
          }
          this.$refs.EditWarehouseAddress.centerDialogVisible = true;
        },
        error => {
          console.log(error);
        }
      );
    },
    //修改参考号
    toEditReferenceNo() {
      this.$refs.EditReferenceNo.centerDialogVisible = true;
    },
    //修改操作备注
    toEditOperationRemark() {
      this.$refs.EditOperationRemark.centerDialogVisible = true;
    },
    //新增操作备注
    toAddOperationRemark() {
      this.$refs.AddOperationRemark.init();
    },
    //修改客户备注
    toEditCustomerRemark() {
      this.$refs.EditCustomerRemark.centerDialogVisible = true;
    },
    //直接修改渠道
    toForceUpdateprovinceId() {
      var param = {};
      param["countryId"] = this.data["countryId"];
      ajax("getToForceUpdateprovinceIdOptions", param).then(
        res => {
          if (res.code == 200) {
            this.countryStateSource = res.data;
          }
          this.$refs.ToForceUpdateprovinceId.centerDialogVisible = true;
        },
        error => {
          console.log(error);
        }
      );
    },
    //直接修改渠道
    toForceUpdateChannel() {
      var param = {};
      ajax("getToForceUpdateChannelOptions", param).then(
        res => {
          if (res.code == 200) {
            this.outStockChannelOptions = res.data;
            this.inStockChannelOptions = res.data2;
          }
          this.$refs.ToForceUpdateChannel.centerDialogVisible = true;
        },
        error => {
          console.log(error);
        }
      );
    },

    //修改入库时间
    touUpdateInstockDate() {
      this.$refs.UpdateInstockDate.centerDialogVisible = true;
    },
    //修改H单
    editUpdateHwaybill() {
      this.$refs.EditUpdateHwaybill.centerDialogVisible = true;
    },

    //导入标签
    toBatchImportTrackLabel() {
      this.$refs.ToBatchImportTrackLabel.centerDialogVisible = true;
    },
    //箱单原始数据
    viewPackOriginalData() {
      this.fullscreenLoading = true;
      var param = {};
      param["id"] = this.data["id"];
      ajax("viewPackOriginalData", param).then(
        res => {
          this.fullscreenLoading = false;
          if (res.code === 200) {
            this.viewPackOriginaltableData = res.data;
          }
          if (this.$refs.ViewPackOriginalData) {
            this.$refs.ViewPackOriginalData.centerDialogVisible = true;
          }
        },
        error => {
          console.log(error);
        }
      );
    },

    //是否进口商认证
    editEoriIsCertified() {
      this.$refs.EditEoriIsCertified.centerDialogVisible = true;
    },

    postParamsEdit(postUrl, info, paramsName, params) {
      this.$confirm("此操作将" + info + ", 是否继续？")
        .then(_ => {
          this.fullscreenLoading = true;
          // TODO 保存操作
          var param = {};
          param["id"] = this.data["id"];
          param["status"] = this.data["status"];
          param[paramsName] = params;
          ajax(postUrl, param).then(
            res => {
              this.fullscreenLoading = false;
              if (res.code != 200) {
                if (null != res.message) {
                  this.$message.error(m(res.message));
                } else {
                  this.$message.error("修改失败!");
                }
              } else {
                this.$message.success("修改成功!");
                this.centerDialogVisible = false;
              }
            },
            error => {
              console.log(error);
            }
          );
        })
        .catch(_ => {});
    },
    cancelInStockTime() {
      this.boosyn = false;
      this.inStockTime = "";
    },
    postParamsEditReturn() {
      var inStockTime = this.data["inStockTime"];
      if (!inStockTime && !this.inStockTime) {
        this.boosyn = true;
        return;
      } else {
        this.boosyn = false;
        this.$confirm("此操作将退货处理, 是否继续？")
          .then(_ => {
            this.fullscreenLoading = true;
            // TODO 保存操作
            var param = {};
            param["id"] = this.data["id"];
            param["status"] = this.data["status"];
            param["attrName"] = "returnWaybill";
            if (this.inStockTime) {
              param["inStockTime"] = this.inStockTime;
            }
            ajax("restoreWaybill", param).then(
              res => {
                this.fullscreenLoading = false;
                if (res.code != 200) {
                  if (null != res.message) {
                    this.$message.error(m(res.message));
                  } else {
                    this.$message.error("修改失败!");
                  }
                } else {
                  this.$message.success("修改成功!");
                  this.centerDialogVisible = false;
                }
              },
              error => {
                console.log(error);
              }
            );
          })
          .catch(_ => {});
      }
    },
    //公共的后台请求
    postEdit(postUrl, info, attrs) {
      this.$confirm("此操作将" + info + ", 是否继续？")
        .then(_ => {
          // TODO 保存操作
          this.fullscreenLoading = true;
          var param = {};
          param["id"] = this.data["id"];
          param["status"] = this.data["status"];
          ajax(postUrl, param, attrs).then(
            res => {
              this.fullscreenLoading = false;
              if (res.code != 200) {
                if (null != res.message) {
                  this.$message.error(m(res.message));
                } else {
                  this.$message.error("修改失败!");
                }
              } else {
                this.$message.success("修改成功!");
                if (postUrl == "returnWaitForConfirm") {
                  this.data["status"] = 10;
                }
                if (postUrl == "clearSubwaybillLabel") {
                  this.data["trackNumber"] = "";
                  this.data["track1Type"] = "";
                  this.data["track2Type"] = "";
                  this.data["trackNumber2"] = "";
                  this.data["trackNumber3"] = "";
                  this.data["track3Type"] = "";
                  this.$refs.EditTrackNo.paramData = {};
                }
                if (postUrl == "outStockReturnBackToDealSend") {
                  this.data["status"] = 20;
                }
                this.centerDialogVisible = false;
              }
            },
            error => {
              console.log(error);
            }
          );
        })
        .catch(_ => {});
    },

    queryAllSurfaceSingle() {
      var param = {};
      ajax("queryAllSurfaceSingle", param).then(
        res => {
          if (res.code != 200) {
            if (null != res.message) {
              this.$message.error(res.message);
            } else {
              this.$message.error("修改失败!");
            }
          } else {
            this.$message.success("修改成功!");
            this.centerDialogVisible = false;
          }
        },
        error => {
          console.log(error);
        }
      );
    }
  }
};
</script>

<style lang="scss" scoped>
.menu-list {
  min-width: 12vw;
  max-height: 90vh;
  overflow-y: auto;
  div {
    padding: 6px 8px;
    cursor: pointer;
    font-size: 12px;
    &:hover {
      background: #51abd1;
      color: #fff;
    }
  }
}
.letter {
  letter-spacing: -2px;
}
.icon-border {
  display: inline-block;
  border: 1px solid;
  width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
}

.pop-main {
  max-height: 90vh;
  overflow-y: auto;
}
</style>
